package 补充.多线程;
class SubThread implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
            if (i == 5) {
                Thread.yield();
            }
        }
    }
}
public class 线程让步 {
    public static void main(String[] args) {
        SubThread subThread = new SubThread();
        new Thread(subThread,"线程1").start();
        new Thread(subThread,"线程2").start();
    }
}
